﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using SmartProject.Entity;

using FluentNHibernate.Mapping;

namespace SmartProject.Mapping
{
    public class MessageMap : ClassMap<Message>
    {
        public MessageMap()
        {
            Table("SmartProject_Message");
            Id(x => x.Id).Column("MessageId");
            References<User>(x => x.Owner)
                .Column("OwnerId")
                .LazyLoad();
            References<User>(x => x.Recipient)
                .Column("RecipientId")
                .Nullable()
                .LazyLoad();
            Map(x => x.Subject).Length(500).Not.Nullable();
            Map(x => x.Description).Length(8000);
            Map(x => x.Opened).Nullable();
            Map(x => x.Active).Not.Nullable();
            Map(x => x.Created).Not.Nullable();
        }
    }
}
